package com.gxh.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.gxh.dto.MachineSalePageQueryDTO;
import com.gxh.mapper.MachineSaleMapper;
import com.gxh.result.PageResult;
import com.gxh.service.MachineSaleService;
import com.gxh.vo.MachineSaleVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MachineSaleServiceImpl implements MachineSaleService {

    @Autowired
    private MachineSaleMapper machineSaleMapper;

    /**
     * 售出记录分页查询
     * @param machineSalePageQueryDTO
     * @return
     */
    public PageResult pageQuery(MachineSalePageQueryDTO machineSalePageQueryDTO) {
        PageHelper.startPage(machineSalePageQueryDTO.getPage(), machineSalePageQueryDTO.getPageSize());
        Page<MachineSaleVO> page = machineSaleMapper.pageQuery(machineSalePageQueryDTO);
        return new PageResult(page.getTotal(), page.getResult());
    }
}
